package com.minhua.jijiehao2.mainframe.mine.productListFragment.impl

import com.minhua.jijiehao2.base.BaseMvpPresenter
import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.bean.ProductBean
import com.minhua.jijiehao2.constants.DefineKey
import com.minhua.jijiehao2.http.CallBack
import com.minhua.jijiehao2.http.ParamsMap
import com.minhua.jijiehao2.mainframe.mine.productListFragment.imp.IProductListPresenter
import com.minhua.jijiehao2.mainframe.mine.productListFragment.imp.IProductListView
import com.minhua.jijiehao2.utils.SPUtils

class ProductListPresenter : BaseMvpPresenter<IProductListView>(), IProductListPresenter {

    private val mProductListModel = ProductListModel()

    override fun getProductList(auditState: Int) {
        val map = ParamsMap()
        map.put("userId", SPUtils.get(DefineKey.USER_ID, ""))
        map.put("auditState", auditState)
        mProductListModel.getProductList(map, object : CallBack<List<ProductBean>>() {
            override fun onSuccess(t: BaseBean<List<ProductBean>>) {
                v?.onListSuccess(t.data!!)
            }
        })
    }
}